<template>
  <div>
    <!-- <h1>商品列表</h1> -->
    <van-nav-bar @click-left="$router.go(-1)" :title="$route.name" left-arrow />

    <van-card
    @click="goDetail(item.id)"
      v-for="item in goodslist"
      :key="item.id"
      :price="item.price.toFixed(2)"
      :desc="item.goodsname"
      :title="item.goodsname"
       :thumb="item.img?$img+item.img:''"
    >
    </van-card>
  </div>
</template>

<script>
import { getCateGoods } from "../util/axios";
export default {
  data() {
    return {
      goodslist: [],
    };
  },
  components: {},
  methods: {
      goDetail(id){

          this.$router.push({
              path:'/goodsdetail',
              query:{
              id
              }
          })
          console.log(id);
      }
  },

  mounted() {
    getCateGoods({ fid: this.$route.query.id }).then((res) => {
      if (res.code == 200) {
        this.goodslist = res.list;
      }
      // console.log(res);/
    });
  },
};
</script>

<style lang="" scoped>
.van-nav-bar {
  width: 100%;

  background-color: rgb(255, 96, 64);
}

</style>
